package com.woorigil.social.controller.admin;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.woorigil.social.DateUtils;
import com.woorigil.social.controller.BaseController;
import com.woorigil.social.domain.landing.Landing;
import com.woorigil.social.domain.landing.LandingCondition;
import com.woorigil.social.domain.landing.LandingDao;
import com.woorigil.social.domain.point.DealPointDao;

@Controller
public class ActiveUserController extends BaseController {
	@Autowired LandingDao landingDao;
	@Autowired DealPointDao dealPointDao;
	
	@RequestMapping("/admin/landing/list")
	public ModelAndView list(LandingCondition condition) {
		condition.setToday(DateUtils.toString(new Date(), "yyyyMMdd"));
		condition.setTodayFormat(LandingCondition.DAY_FORMAT);
		List<Landing> landingList = landingDao.search(condition);
		int userCount = landingDao.selectUserCount(condition);
		
		ModelAndView mav = new ModelAndView(getForwordPage("admin/landing/list"));
		mav.addObject("landingList", landingList);
		mav.addObject("userCount", userCount);
		return mav;
	}
}
